package com.lz.utils;

import com.lz.vo.ResultVO;

/**
 * 返回值工具类
 * Created by lz on 2018/8/10.
 */
public class ResultVOUtil {

    /**
     * 成功返回
     * @param o 数据对象
     * @return resultVO 结果对象
     */
    public static ResultVO success(Object o){
        ResultVO resultVO = new ResultVO();
        resultVO.setData(o);
        resultVO.setMsg("成功");
        resultVO.setCode(0);
        return resultVO;
    }

    /**
     * 返回空
     * @return resultVO结果对象
     */
    public static ResultVO success(){
        return success(null);
    }

    /**
     * 错误返回
     * @param code 错误代码
     * @param msg 返现信息
     * @return resultVO 结果对象
     */
    public static ResultVO error(Integer code,String msg){
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;

    }
}
